import { Injectable } from '@angular/core';
import { Observable } from  'rxjs';
import { catchError, map, tap } from 'rxjs/operators';
import { HttpClient, HttpErrorResponse, HttpHeaders, HttpResponse, HttpResponseBase } from '@angular/common/http'
import { LoginPostReq, HTTPReturnData } from './login-frame.entity';
import { ENTRY } from '../../enter';
@Injectable({
  providedIn: 'root'
})
export class LoginFrameService {

  constructor(private http: HttpClient) { }
  private loginReqUrl = ENTRY + 'login/';

  public postLogin(usr: string, pass: string): Observable<HTTPReturnData> {
    let postData: LoginPostReq = {
      username: usr,
      password: pass
     };
     console.log(postData, 'postData');
    return this.http.post<HTTPReturnData>(this.loginReqUrl, postData);
  }
}
